﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 重载2
{
    class SumUtils
    {
        private double _num1;
        private double _num2;
        private int _num3;
        private string _num4;
        private string _num5;

        public double Sum(double num1,double num2)
        {
            this._num1 = num1;
            this._num2 = num2;
            double sum;
            sum = this._num1 + this._num2;
            return sum;
        }
        public string Sum(string str1, string str2)
        {
            this._num4 = str1;
            this._num5 = str2;
            string strSum;
            strSum = this._num4 + this._num5;
            Console.WriteLine(strSum);
            return strSum;

        }
        public int Sum(int num1)
        {
            int accumulate=0;
            for (int i = 1; i <= num1; i++)
            {
                accumulate += i;
            }
            return accumulate;
        }

        public void Result(double num1 , double num2 ,string str1,string str2 , int num3)
        {
            Console.WriteLine("累加和为{0}",Sum(num3));
            Console.WriteLine("小数和为{0}", Sum(num1, num2));
            Console.WriteLine("字符串和为{0}", Sum(str1,str2));
        }
    }
}
